Skip to content

Conversation

@Avasam
Copy link
Collaborator

@Avasam Avasam commented Apr 27, 2025

See actions/runner-images#12045

Had to manually install a VisualStudio component because of actions/runner-images#9701 / actions/runner-images#9873

The new step unfortunately takes an extra ~8 minutes. So I had to increase the timeout as some jobs can now take up to 21 minutes. I wish we didn't have to. Feel free to whine at Microsoft 🙃
(Is there some caching we could do?)

@Avasam Avasam force-pushed the update-to-windows-2022-runner-image branch 2 times, most recently from 924a68d to 52bd87e Compare April 27, 2025 03:42
@Avasam Avasam force-pushed the update-to-windows-2022-runner-image branch from 52bd87e to 711ddb1 Compare April 27, 2025 04:08
@Avasam Avasam requested a review from mhammond April 27, 2025 04:28
@Avasam Avasam changed the title Update to Windows 2022 runner image [Merge by June 2025] Update to Windows 2022 runner image Apr 27, 2025
@geppi
Copy link
Collaborator

geppi commented Apr 27, 2025

Shall we also retarget the PyCOMTest server project file in this PR? Not that it would make any functional difference but just to be in line with the default Win SDK version in the runner.

Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$VsInstallPath = vswhere.exe -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
[string]$ComponentsToAdd = @(
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"
Copy link
Collaborator Author

@Avasam Avasam Apr 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to get info about the CI's VS and MSVC versions and this is what I got using vswhere -latest
https://github.com/mhammond/pywin32/actions/runs/14687605417/job/41218346703?pr=2582#step:6:6

$VS_PATH = vswhere.exe -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
echo "VS_PATH=$VS_PATH" >> $env:GITHUB_ENV
echo "MSVC_VERSION=$(((Get-Content "$VS_PATH\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt") -split '\.')[0..1] -join '.')" >> $env:GITHUB_ENV
echo "VS_VERSION=$(((vswhere.exe -latest -property installationVersion) -split '\.')[0..1] -join '.')" >> $env:GITHUB_ENV

Results in:

VS_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise
MSVC_VERSION: 14.43
VS_VERSION: 17.13

Which is completely different than the 14.29 and 16.11 needed here. That's why I hardcoded this component version number.

Comment on lines 80 to 82
# should be run twice for some reason
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
Start-Process -FilePath vs_installer.exe -ArgumentList $ArgumentList -Wait -PassThru -WindowStyle Hidden
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find an explanation in any of the linked issues as to why we need to run this twice. But I confirmed it's needed. It sure doesn't help with the extra time it takes.

@Avasam
Copy link
Collaborator Author

Avasam commented Apr 27, 2025

Shall we also retarget the PyCOMTest server project file in this PR? Not that it would make any functional difference but just to be in line with the default Win SDK version in the runner.

Assuming you're talking about Project.PropertyGroup.WindowsTargetPlatformVersion in PyCOMTest.vcxproj, would we want to target as old as possible (yet still supported by pywin32, so Windows 7, or at least Windows 8.1 SDK):

pywin32/setup.py

Lines 133 to 136 in ddc14b2

# Minimum Windows version supported (Windows 7 / Windows Server 2008)
# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
("_WIN32_WINNT", hex(0x0601)),
("WINVER", hex(0x0601)),

To be as compatible as possible with anyone wanting to run the tests locally. And ensure we don't create tests that only run in newer Windows.

Or is there some other advantages to targeting a newer SDK?

@geppi
Copy link
Collaborator

geppi commented Apr 28, 2025

I must confess that I'm a little confused by the mess that Microsoft has created around the windows-2022 runner.

Currently the PyCOMTest server dll project file is targeted for the platform toolset v142 and the Windows SDK 10.0.22000.0.
I had to target it for these versions because this is what's available on the windows-2019 runner.

My local installation of Visual Studio 2022 Community Edition is currently version 17.13.6 and provides by default the platform toolset v143. As mentioned here I have to retarget the project file to platform toolset v143 for a local build which is a little annoying.

Reading the communication regarding the removal of multiple VC build tools I would be surprised if the PyCOMTest server dll will still build after May 13th, i.e. after the rollout of the announced changes.

IIUC retargeting the project file for the platform toolset v143 would be required.

This would also have the desirable side effect that for a local build with the recent version of Visual Studio, i.e. 2022, no retargeting would be required.

Regarding the targeted Windows SDK, I don't think that it makes any difference for the PyCOMTest server dll, so we should aim for a current version that's available in Visual Studio 2022.

@Avasam
Copy link
Collaborator Author

Avasam commented Apr 28, 2025

My local installation of Visual Studio 2022 Community Edition is currently version 17.13.6 and provides by default the platform toolset v143. As mentioned #2493 (comment) I have to retarget the project file to platform toolset v143 for a local build which is a little annoying.

I don't have to retarget anything locally, but here's my installations:

image

And I do have a couple (v142 and v143) MSVC build tools installed though
Build Tools 2022
image
image
image
image

Build Tools 2019
image

VS Community 2022
image
image

I would be surprised if the PyCOMTest server dll will still build after May 13th, i.e. after the rollout of the announced changes.

That's may 2024. We're already past that. And PyCOMTest did fail building w/o the manual component install I added.

Regarding the targeted Windows SDK, I don't think that it makes any difference for the PyCOMTest server dll, so we should aim for a current version that's available in Visual Studio 2022.

Here's everything available with 2022 Build Tools:
image

@geppi
Copy link
Collaborator

geppi commented Apr 28, 2025

OK, I give up.
Looks like I had a senior moment when I read the removal announcement and didn't realize that it's a year old.

All I can say is that the Visual Studio 2022 installer did offer me to install the v142 build tools but after installing them the build did still fail because of the missing ATL header file. The installer did only offer the C++ ATL for the latest v143 build tools but not for v142..

I didn't investigate where I could probably get the C++ ATL for the v142 build tools and just retargeted the solution for v143 locally.

If you think that keeping the project file targeted for the old v142 build tools on the newer 2022 runner I don't want to waste your and my time anymore with this version mess.

@Avasam
Copy link
Collaborator Author

Avasam commented Apr 28, 2025

If you think that keeping the project file targeted for the old v142 build tools on the newer 2022 runner I don't want to waste your and my time anymore with this version mess.

Tbh I'm not thinking much here. I'm just as lost as you are, if not more. 😓

I just don't want the CI to stop working come June 2025 because of the eventual random brownouts and removal of windows-2019.

If retargeting can avoid the Install missing Visual Studio components step, then that's a big benefit. Otherwise idk which versions would be beneficial or not.


Btw this is all a predecessor to #2581 . I wouldn't even have noticed the windows-2019 deprecation otherwise.

Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree this kinda sucks, but I also see no better options - thanks!

@Avasam Avasam merged commit 0507672 into mhammond:main May 29, 2025
65 of 68 checks passed
@Avasam Avasam deleted the update-to-windows-2022-runner-image branch May 29, 2025 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants